import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State {
  final _biggerFont = new TextStyle(fontSize: 18.0);
  final _pageNames = <String>["wordpairPage", "imagePage", "TabNaviPage"];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: new AppBar(title: new Text("示例列表")),
      body: _buildListView(),
    );
  }

  Widget _buildListView() {
    return new ListView.builder(
      padding: new EdgeInsets.all(16.0),
      itemCount: _pageNames.length,
      itemBuilder: (context, i) {
        return _buildListRow(_pageNames[i]);
      },
    );
  }

  Widget _buildListRow(String name) {
    return new Column(
      children: [
        new ListTile(
          title: new Text(name, style: _biggerFont),
          trailing: Icon(Icons.arrow_forward_ios, size: 15.0),
          onTap: () {
            Navigator.pushNamed(context, "/" + name);
          },
        ),
        new Divider(
          height: 1,
          color: Colors.grey[500],
        )
      ],
    );
  }
}
